package com.sl.au.service.impl;
/**
 * 帐台台账
 * zty
 * 2017-02-20
 */
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.entity.EXDEPayAgingAccountInfo;
import com.sl.au.repository.EXDEPayAgingAccountRepository;
import com.sl.au.service.EXDEPayAgingAccountService;
@Service("EXDEPayAgingAccountService")
@Transactional
public class EXDEPayAgingAccountServiceImpl extends BaseServiceImpl implements EXDEPayAgingAccountService{
	@Autowired
	EXDEPayAgingAccountRepository exdePayAgingAccountRepository;
	public EXDEPayAgingAccountRepository getRepository() {
		return exdePayAgingAccountRepository;
	}
	/*
	 * 获取表数据
	 */
	@Override
	public List<EXDEPayAgingAccountInfo> getMyPage(int start, int length, String superior, String key) {
		Page<EXDEPayAgingAccountInfo> pages=null;
		Pageable pageable=new PageRequest(start/length,length,Sort.Direction.DESC,"cdutyOfficer");//排序
		if(key != null && !key.equals("")){
			pages=exdePayAgingAccountRepository.getexdePayAgingAccountInfo(superior,key,pageable);//注意顺序
		}else{
			pages=exdePayAgingAccountRepository.getexdePayAgingAccountInfo(superior,pageable);
		}
		return pages.getContent();
	}
	/*
	 * 获取条数
	 */
	@Override
	public long getCount(int start, int length, String superior, String key) {
		long pagesCount = 0;
		if(key != null && !key.equals("")){
			pagesCount = exdePayAgingAccountRepository.getCount(superior,key);//注意顺序
		}else{
			pagesCount = exdePayAgingAccountRepository.getCount(superior);
		}
		
		return pagesCount;
		
	}
}
